
import rsa from './rsa'

const RSA_EXPONENT = '10001'
const RSA_MODULUS = 'RSA_MODULUS'

/**
 * rsa加密
 * @param {Object} text
 */
export function rsaEncrypt (text) {
    let key = new rsa.RSAKeyPair(RSA_EXPONENT, '', RSA_MODULUS)
    let encryptRtn = rsa.encryptedString(key, text)
    return encryptRtn
}

/**
 * rsa解密
 * @param {Object} text
 */
export function rsaDecrypt (text) {
    let key = new rsa.RSAKeyPair('', RSA_EXPONENT, RSA_MODULUS)
    let decryptedRtn = rsa.decryptedString(key, text)
    return decryptedRtn
}
